home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / libg_261.zip / libg_261 / libg++ / test-install / Makefile.in < prev   
Makefile  |  1994-04-15  |  4KB  |  171 lines

  1. ###*#######################################################################
  2. #
  3. # Makefile to test the installation of g++ and libg++
  4. # (by hgs@cygnus.com)
  5. # Usage: make foo_main test-90S test-90D PREFIX=prefix [other macros]
  6.  
  7. srcdir = .
  8.  
  9.  
  10. #
  11. # Compilation macros
  12. #
  13. PREFIX        = $(prefix)
  14.  
  15. CFLAGS        =
  16. CXXFLAGS    =
  17. CPP_FLAGS    = #-I$(srcdir)/../g++-include
  18. OPTIMIZE_FLAGS    = -O
  19. DEBUG_FLAGS    = -g -v #-Wall
  20. COMPILE_FLAGS=$(NOSTDINC) -I.. -I$(srcdir) -I$(srcdir)/../src -I$(srcdir)/../$(IO_DIR) $(WRAP_C_INCLUDES)
  21.  
  22. DEPEND_SOURCES = $(srcdir)/*.cc
  23.  
  24.  
  25. T90  = $(T90S) $(T90D)
  26. T90D =  # dex_bar
  27.  
  28. FLAGS_90 = \
  29.  GXX="$(GXX)"\
  30.  CPP_FLAGS="$(CPP_FLAGS)"\
  31.  OPTIMIZE_FLAGS="$(OPTIMIZE_FLAGS)"\
  32.  DEBUG_FLAGS="$(DEBUG_FLAGS)"\
  33.  GXXLDFLAGS="$(GXXLDFLAGS)"
  34.  
  35. #### package, host, target, and site dependent Makefile fragments come in here.
  36. ##
  37.  
  38.  
  39. TEMP_FILES = *.o foo_main a b *foo_main.out *foo_main.diff *foo_main.run
  40.  
  41. help:
  42.     @echo Usage: make foo_main test-40 test-90S test-90D PREFIX=prefix [other macros]
  43.  
  44.  
  45. test-90S: foo_main a b
  46.  
  47. test-90S-then-clean: test-90S
  48.     rm -f ${TEMP_FILES}
  49.  
  50. test-90D: dfoo_main da db
  51.  
  52. test-90D-then-clean: test-90D
  53.     rm -f ${TEMP_FILES}
  54.  
  55. test: $(TEST)
  56.     for P in $(TEST) ; do if [ $$P != foo_main ]; then eval ./$$P; fi; done
  57.  
  58. a : a.o
  59.     $(CXX) -o a  a.o $(LIBS)
  60. da : a.o
  61.     $(CXX) -o da -dynamic  a.o $(LIBS)
  62.  
  63.  
  64. b : bf.o bm.o
  65.     $(CXX) -o b bm.o bf.o $(LIBS)
  66.  
  67. db : bf.o bm.o
  68.     $(CXX) -o db -dynamic bm.o bf.o $(LIBS)
  69.  
  70.  
  71. foo_main:   foo_main.diff
  72.     @true
  73.  
  74. dfoo_main: dfoo_main.diff
  75.     @true
  76.  
  77. foo_main.run: foo_main.o foo_func.o Foo.o expected.out
  78.     $(CXX) $(DEBUG_FLAGS) -o $@  foo_main.o foo_func.o Foo.o
  79.  
  80. foo_main.out: foo_main.run
  81.     ./foo_main.run > foo_main.out
  82.  
  83. foo_main.diff: foo_main.out $(srcdir)/expected.out
  84.     @echo "diff $(srcdir)/expected.out foo_main.out >foo_main.diff"
  85.     @diff $(srcdir)/expected.out foo_main.out >foo_main.diff \
  86.       || (echo "Static constructor test failed - see libg++/README"; false)
  87.  
  88. dfoo_main.run: foo_main.o foo_func.o Foo.o
  89.     $(CXX) $(DEBUG_FLAGS) -o $@ -dynamic foo_main.o foo_func.o Foo.o $(LIBS)
  90.  
  91. dfoo_main.out: dfoo_main.run
  92.     ./dfoo_main.run > dfoo_main.out
  93.  
  94. dfoo_main.diff: dfoo_main.out $(srcdir)/expected.out
  95.     diff $(srcdir)/expected.out dfoo_main.out
  96.  
  97. ex_bar.o: ex_bar.cc
  98.     $(CXX) -fhandle-exceptions ex_bar.cc
  99.  
  100. ex_bar: ex_bar.o
  101.     $(CXX) $(DEBUG_FLAGS) -o $@ ex_bar.o
  102.  
  103. dex_bar: ex_bar.o
  104.     $(CXX) $(DEBUG_FLAGS) -o $@ -dynamic ex_bar.o
  105.  
  106. # --- Generate depend rules ---
  107.  
  108. SRCDIR=$(srcdir)/..
  109.  
  110. # The sed script below attempts to make the depend output portable by
  111. # making the output use the same macros used elsewhere in the Makefile:
  112. # - It replaces double // by a single /.
  113. # - It replaces include files that match part of the GXX_INCLUDE_DIRS
  114. #   by names defined in terms of the macros used to define GXX_INCLUDE_DIRS.
  115. # - It removes any absolute include file names that remain.
  116. # - then remove lines, which contain only `\'
  117. #
  118. depend: depend.tmp
  119.     if [ "x$(DEPEND_SOURCES)" != "x" ] ; then \
  120.     sed < depend.tmp \
  121.       -e 's|//|/|g' \
  122.       -e 's|$(srcdir)|$$(srcdir)|g' \
  123.       -e 's| /[^ ]*[.]h||g' \
  124.       -e 's|: *\$$(srcdir)/\(.*\.[cC]*\)|: \1|' \
  125.       -e '/^[     ]*\\$$/d' -e 's/^[     ]*$$//' \
  126.     | awk 'BEGIN   { prev = "" } \
  127.           /^( )*$$/ { if (prev ~ /\\$$/) \
  128.              { prev = substr(prev,1,length(prev)-1); next } \
  129.                } \
  130.                        { print prev; prev = $$0 } \
  131.            END { if (prev !~ /^( )*$$/) print prev }' \
  132.     > $(srcdir)/depend ;\
  133.     fi
  134.  
  135. depend.tmp: $(DEPEND_SOURCES) 
  136.     if [ "x$(DEPEND_SOURCES)" = "x" ] ; then \
  137.       echo "" > $(srcdir)/depend ;\
  138.     else \
  139.     echo "" >depend.tmp ; \
  140.     $(SRCDIR)/utils/g++dep.sh -f depend.tmp $(GXX_INCLUDE_DIRS) \
  141.       $(DEPEND_SOURCES) ;\
  142.     fi
  143.  
  144. do_depend: depend
  145.     if [ "$(SUBDIRS)" != "" ] ; then \
  146.     for D in $(SUBDIRS) x ; do                \
  147.         if [ -d $$D ] ; then            \
  148.         echo "cd $$D; $(MAKE) do_depend" ; \
  149.         (cd $$D ; $(MAKE) do_depend );       \
  150.         fi ;                   \
  151.     done ;\
  152.     fi
  153.     
  154. # DO NOT DELETE THIS LINE -- g++dep uses it.
  155. # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
  156.  
  157. Foo.o : Foo.cc \
  158.   $(srcdir)/Foo.h
  159. a.o : a.cc 
  160. bf.o : bf.cc 
  161. bm.o : bm.cc 
  162. ex_bar.o : ex_bar.cc \
  163.   $(srcdir)/ex_bar.cc
  164. foo_func.o : foo_func.cc \
  165.   $(srcdir)/Foo.h
  166. foo_main.o : foo_main.cc \
  167.   $(srcdir)/Foo.h
  168.  
  169. # IF YOU PUT ANYTHING HERE IT WILL GO AWAY
  170.